<template>
  <view style="padding:20rpx">
    <rich-text :nodes="privacy.configValue"></rich-text>
  </view>
</template>

<script>
import { getByKeyApi } from "@/sheep/api/index";
export default {
  data() {
    return {
      privacy: {},
      type: null,
    };
  },
  onLoad(options) {
    if (options?.type) {
      this.type = options.type;
      console.log(this.type);
      this.getPrivacy();
    }
  },
  methods: {
    /** 获取公告 */
    async getPrivacy() {
      let res = await getByKeyApi("buyProtocol");
      this.privacy = res.data.filter((item) => item.remark == this.type)[0];
      //富文本图片宽度100%
      this.privacy.configValue = this.privacy.configValue.replace( /<img/g,  '<img style="width:100%"');
      let title = this.privacy.configName;
      uni.setNavigationBarTitle({
        title: title,
      });
    },
  },
};
</script>
